package com.youxin.foundation.utils;


import com.youxin.foundation.lang.BaseException;
import com.youxin.foundation.lang.NullPointerBusException;

/**
 * 对象基本类
 * @author yingde.cao
 *
 */
public class ObjectUtils {
	
	public static void reququestCondition(boolean condition,String message)
	{
		if(!condition)
		{
			throw new BaseException(message);
		}
	}
	
	public static Object requestNonNull(Object obj)
	{
		if (obj == null)
            throw new NullPointerBusException("参数不能为NULL");
        return obj;		
	}
	
	public static Object requestNonNull(Object obj,String message)
	{
		if (obj == null)
            throw new NullPointerBusException(message);
        return obj;		
	}
	
	public static Object requestNonEmpty(String obj,String message)
	{
		if (StringUtils.isNullOrEmpty(obj))
            throw new BaseException(message);
        return obj;		
	}
	
	public static Object requestNonTrimEmpty(String obj,String message)
	{
		obj=StringUtils.trim(obj);
		if (StringUtils.isNullOrEmpty(obj))
            throw new BaseException(message);
        return obj;		
	}
	
}
